<!DOCTYPE html>
<html>

<head>
      {% load static %}
      <title>Расписание</title>
      <link rel="stylesheet" href="{% static 'accounts/ceopredict.css' %}">
      <link rel="icon" href="{% static 'images/favicon.ico' %}">
      <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
</head>

<body>
      <!--<nav class="navbar">
            <img style="margin: 10px" src="./images/logo_center.png" width="120" height="120" alt="logo">
            
            <div class="auth-data" style="text-align: center;">
              <p style="margin-right: 10px;">Вы авторизированы как HR</p>
              <a href="">Logout</a>
            </div>
      </nav> -->   
      <nav class="navbar navbar-expand-lg bg-body-tertiary">
        <div class="container-fluid">
          <a class="navbar-brand" href="#">
		  <img src="{% static 'accounts/images/logo_center.png' %}" width="120px" height="120px">
          </a>
          <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
          </button>
          <div class="collapse navbar-collapse" id="navbarNav">
            <ul class="navbar-nav">
              <li class="nav-item">
		      <a class="nav-link active" aria-current="page" href="{% url 'accounts:mr-cab-month' user_id=uid %}">Управление графиком</a>
              </li>
              <li class="nav-item">
		      <a class="nav-link" href="{% url 'accounts:mr-cab-hr' user_id=uid %}">Управление кадрами</a>
              </li>
	      {% if notifications %}
	      <li class="nav-item">
			<a class="nav-link" href="{% url 'accounts:mr-cab-not' user_id=uid %}" style="color: red; font-weight: bold;">Уведомления</a>
	      </li>
	      {% else %}
              <li class="nav-item">
		      <a class="nav-link" href="{% url 'accounts:mr-cab-not' user_id=uid %}">Уведомления</a>
              </li>
	      {% endif %}
              <li class="nav-item">
		      <a class="nav-link"  href="{% url 'accounts:mr-cab-pred' user_id=uid %}">Прогнозирование количества исследований</a>
              </li>
            </ul>
            <div class="ms-auto" style="text-align: center;">
              <p style="margin-right: 10px;">Вы авторизированы как Руководитель</p>
	      <a href="{% url 'accounts:logout' %}">Выйти</a>
            </div>
          </div>
        </div>
      </nav>
      <h3 style="text-align: center;">Прогноз</h3>
      <div class="table-container">
        <table>
          <thead>
            <tr>
              <th class="th" rowspan="2"></th>
              <th class="th" colspan="10">День недели</th>
            </tr>
            <tr>
              <th class="th">Денситометрия</th>
              <th class="th">КТ</th>
              <th class="th">КТ с КУ 1 зона</th>
              <th class="th">КТ с КУ 2 и более зон</th>
              <th class="th">ММГ</th>
              <th class="th">МРТ</th>
              <th class="th">МРТ с КУ 1 зона</th>
              <th class="th">МРТ с КУ 2 и более зон</th>
              <th class="th">РГ</th>
              <th class="th">ФЛГ</th>
            </tr>
          </thead>
          <tbody>
	    {% for prediction in predictions %}
            <tr>
	      <td class="td">{{prediction.week_num}} неделя</td>
	      <td class="td">{{prediction.dens}}</td>
	      <td class="td">{{prediction.kt}}</td>
	      <td class="td">{{prediction.kt1}}</td>
              <td class="td">{{prediction.kt2}}</td>
              <td class="td">{{prediction.mmg}}</td>
              <td class="td">{{prediction.mrt}}</td>
	      <td class="td">{{prediction.mrt1}}</td>
	      <td class="td">{{prediction.mrt2}}</td>
	      <td class="td">{{prediction.rg}}</td>
	      <td class="td">{{prediction.flu}}</td>
            </tr>
	    {% endfor %}
          </tbody>
          <tfoot>
            <tr>
		   <form id="fileUploadForm" action="{% url 'accounts:excel_import_count' %}" method="post" enctype="multipart/form-data">
    		{% csrf_token %}
    		<th class="th" colspan="11">
        	<label for="excelFile" class="btn btn-primary">Внести данные из Excel</label>
        	<input type="file" id="excelFile" name="excel_file" style="display: none;" accept=".xls,.xlsx" required>
        	<button type="submit" id="Submit" class="btn btn-primary" style="display: none;">Выгрузить</button>
		<button id="download-button" class="btn btn-primary">Скачать предсказания</button>
    </th>
</form>

<script>
    document.getElementById('excelFile').addEventListener('change', function() {
        document.getElementById('Submit').style.display = 'inline-block';
    });
        document.getElementById("download-button").addEventListener("click", function() {
            window.location.href = "{% url 'accounts:download_pred' %}";
        });
</script>
            </tr>
          </tfoot>
        </table>
      </div>
</body>

</html>
